#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2023/12/2 23:16
# @Author  : huidong.bai
# @File    : MongoLock.py
# @Software: PyCharm
# @Mail    : MasterBai2018@outlook.com

from conftest import thLock


class MongoLock:
    def __init__(self):
        self.thlock = thLock

    def __enter__(self):
        self.thlock.acquire()
        return self

    def __exit__(self, exc_type, exc_value, traceback):
        # 关闭线程锁
        self.thlock.release()

mongoLock = MongoLock()
